home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
NASA Climatology Interdisciplinary Data Collection
/
NASA Climatology Interdisciplinary Data Collection - Disc 1.iso
/
cdrom.gui
< prev
next >
Wrap
Text File
|
1998-04-06
|
16KB
|
298 lines
# cdrom.gui - last revision: Jan 14, 1998
#
# Sample widget script for the CIDC CDROM.
#
# How to invoke this script:
#
# At startup. Set the enviroment variable GAGUI with the
# name of the script file, e.g.,
#
# % setenv GAGUI cdrom.gui
#
# At the GrADS command line prompt. Simply type
#
# ga> gui cdrom.gui
#
# Of course, you must have a version of GrADS built with
# Athena Widgets support.
#
# (c) 1997 Arlindo da Silva (dasilva@gsfc.nasa.gov)
#
# *** Copy freely but DO NOT sell ***
#
# See also sample.gui.
#.........................................................................
# Most "exec" commands are supported
# ----------------------------------
set gxout shaded
# A "label" is an inactive widget which display some text,
# e.g., an informative title. The first argument, "root"
# in this case, is the name you give to the widget so that
# you can refer to it later on
# -------------------------------------------------------
MakeLabel(root,"CIDC CDROM I")
# This command creates a dropdown menu called " File... "
# as usual, the first argument "file" is the name of the
# widget
# -------------------------------------------------------
MakeMenu ( file, "File" )
# Once you make a memu, you create its items. For the first item:
# --------------------------------------------------------------
MakeMenuItem(open, file, "Open", Load, "open")
# The parameters this particular item are:
# open the name of the item widget
# file the menu the item belongs to (see MakeMenu above)
# "Open" This is the text it displays on the screen
# Load this is the callback name, i.e., the widget invokes
# this function when pressed. This particular callback
# pops up a "file finder" widget, and after the user
# clicks on a file name it executes the grads command
# "open" (see last argument) on this file. A list
# of the other available callbacks can be found in the
# end of this file.
# "open" Argument to be passed to the callback. In this
# particular case, it is the GrADS command to be
# executed on the file.
# The definition of the other items in this menu follows.
MakeMenuItem(fsel, file, "File Selection ", FileSel, NULL )
MakeMenuItem(browse, file, "View Text File", Browse, NULL)
MakeMenuItem(junk, file, "_______________", NULL, NULL )
MakeMenuItem(exec, file, "Exec", Load, "exec")
MakeMenuItem(run, file, "Run", Load, "run")
MakeMenuItem(gui, file, "GUI", Load, "gui")
MakeMenuItem(junk, file, "_______________", NULL, NULL )
MakeMenuItem(init, file, "Reinit", Cmd, "reinit")
MakeMenuItem(exit, file, "Exit", Cmd, "quit")
# A menu with assorted internal options
# -------------------------------------
MakeMenu ( options, "Options" )
MakeMenuItem(map, options, "Continental Boundaries on/off", CmdStr, "set mpdraw " )
MakeMenuItem(tit, options, "Draw Title", CmdStr, "draw title " )
MakeMenuItem(cbar, options, "Color Bar", Cmd, "run cbarn" )
MakeMenuItem(junk, options, "_______________", NULL, NULL )
MakeMenuItem(shade, options, "Shaded", Cmd, "set gxout shaded" )
MakeMenuItem(cont, options, "Contour", Cmd, "set gxout contour" )
MakeMenuItem(grfill, options, "Grid Fill", Cmd, "set gxout grfill" )
MakeMenuItem(grvals, options, "Grid Values", Cmd, "set gxout grid" )
MakeMenuItem(vec, options, "Vector", Cmd, "set gxout vector" )
MakeMenuItem(line, options, "Line Plot", Cmd, "set gxout line" )
MakeMenuItem(bar, options, "Bar Chart", Cmd, "set gxout bar" )
# Creates simple buttons. Buttons work pretty much like menu items
# but they do not belong to any menu and are directly clickable.
# ------------------------------------------------------------------
MakeButton( clear, "Clear", Cmd, "clear" )
MakeButton( quit, "Quit", Cmd, "quit" )
MakeButton( prompt, "ga>", CmdWin, NULL )
# A menu for defining GrADS dimensions. This is very crude right now.
# I will be developing a specific callback with rubber bands
# etc. for these functions. Stay tuned.
# ------------------------------------------------------------------
MakeMenu( dim, "Dim")
MakeMenuItem(lat, dim, "Latitude", CmdStr, "set lat " )
MakeMenuItem(lon, dim, "Longitude", CmdStr, "set lon " )
MakeMenuItem(time, dim, "Time", CmdStr, "set time " )
MakeMenuItem(junk, dim, "_________", NULL, NULL )
MakeMenuItem(x, dim, "x", CmdStr, "set x " )
MakeMenuItem(y, dim, "y", CmdStr, "set y " )
MakeMenuItem(t, dim, "t", CmdStr, "set t " )
# Frequently used buttons (and toggle)
# -----------------------------------
MakeButton( var, "Var", VarSel, NULL )
MakeToggle( hold, "Hold", FALSE, NULL, Toggle, "hold" )
MakeButton( prev, " << ", Display, "<<" )
MakeButton( displ, "Display", Display, "DISPLAY" )
MakeButton( next, " >> ", Display, ">>" )
MakeButton( rein, "Reinit", Cmd, "reinit")
MakeButton( fresh, "Fresh", Cmd, " ")
# CIDC CD-ROM I menu's
# -------------
MakeMenu(ac, "Atmosphere")
MakeMenuItem(tm, ac, "TOMS Ozone", Open, "open data/atmo_constituents/toms_ozone/tomsn7.o3.1nmegg.ctl" )
MakeMenu(bi, "Biosphere")
MakeMenuItem(av, bi, "AVHRR Pathfinder NDVI", Open, "open data/biosphere/avhrr_ndvi/avhrr_pf.ndvi.1nmegl.ctl" )
MakeMenuItem(xx, bi, "_______________________________", NULL, NULL )
MakeMenuItem(cz, bi, "CZCS Monthly Ocean Pigment Concentration", Open, "open data/biosphere/czcs_color/czcs.chlrcn.1nmego.ctl" )
MakeMenuItem(cm, bi, "CZCS Climate monthly Ocean Pigment Concentration", Open, "open data/biosphere/czcs_color/climate/czcs.chlrcn.1ncego.ctl" )
MakeMenuItem(cc, bi, "CZCS Climate Ocean Pigment Concentration", Open, "open data/biosphere/czcs_color/climate/czcs.chlrcn.1nxego.ctl" )
MakeMenuItem(xx, bi, "_______________________________", NULL, NULL )
MakeMenuItem(lc, bi, "ISLSCP Land Cover", Open, "open data/biosphere/land_cover/islscp.vegmap.1nnegl.ctl" )
MakeMenu(cr, "Cryosphere")
MakeMenuItem(smi, cr, "SMMR Nimbus-7 Sea Ice Concentration", Open, "open data/hydrology/sea_ice/smmr_n07.seaice.1nmego.ctl" )
MakeMenuItem(ssi8, cr, "SSMI DMSP-F8 Sea Ice Concentration", Open, "open data/hydrology/sea_ice/ssmi_f08.seaice.1nmego.ctl" )
MakeMenuItem(ssi1, cr, "SSMI DMSP-F11 Sea Ice Concentration", Open, "open data/hydrology/sea_ice/ssmi_f11.seaice.1nmego.ctl" )
MakeMenuItem(ssi3, cr, "SSMI DMSP-F13 Sea Ice Concentration", Open, "open data/hydrology/sea_ice/ssmi_f13.seaice.1nmego.ctl" )
MakeMenuItem(xx, cr, "__________________________", NULL, NULL )
MakeMenuItem(sms, cr, "SMMR Snow Depth", Open, "open data/hydrology/smmr_snow/smmr_snw.depth.1nmegl.ctl" )
MakeMenu(hy, "Hydrology")
MakeMenuItem(gcp, hy, "GPCC Precipitation measurements", Open, "open data/hydrology/precip/gpcp/gpcc/gpcc_gag.pcp.1nmegl.ctl" )
MakeMenuItem(gco, hy, "GPCC Precipitation observations", Open, "open data/hydrology/precip/gpcp/gpcc/gpcc_gag.obs.1nmegl.ctl" )
MakeMenuItem(xx, hy, "__________________________", NULL, NULL )
MakeMenuItem(gpp, hy, "GPCP Precipitation measurements", Open, "open data/hydrology/precip/gpcp/gpcp_v1a_cmb/gpcp_v1a.psg.1nmegg.ctl" )
MakeMenuItem(gpo, hy, "GPCP Precipitation errors", Open, "open data/hydrology/precip/gpcp/gpcp_v1a_cmb/gpcp_v1a.esg.1nmegg.ctl" )
MakeMenuItem(xx, hy, "__________________________", NULL, NULL )
MakeMenuItem(fad, hy, "FAO Depth", Open, "open data/hydrology/soil/fao_soil.depth.1nnegl.ctl" )
MakeMenuItem(fas, hy, "FAO Slope", Open, "open data/hydrology/soil/fao_soil.slope.1nnegl.ctl" )
MakeMenuItem(fax, hy, "FAO Texture", Open, "open data/hydrology/soil/fao_soil.textur.1nnegl.ctl" )
MakeMenuItem(fat, hy, "FAO Type", Open, "open data/hydrology/soil/fao_soil.type.1nnegl.ctl" )
MakeMenuItem(xx, hy, "__________________________", NULL, NULL )
MakeMenuItem(ssp, hy, "SSMI Precipitable Water", Open, "open data/hydrology/ssmi_wvap/ssmi.prch2o.1nmego.ctl" )
MakeMenu(mo, "Monsoon")
MakeMenuItem(smp, mo, "SMMR Monsoon Precipitation Rate month", Open, "open data/hydrology/precip/smmr_monsoon/smmr.rain.1nmeo1.ctl" )
MakeMenuItem(sma, mo, "SMMR Monsoon Precipitation Rate annual", Open, "open data/hydrology/precip/smmr_monsoon/smmr.rain.1naeo1.ctl" )
MakeMenuItem(smc, mo, "SMMR Monsoon Precipitation Rate climate monthly", Open, "open data/hydrology/precip/smmr_monsoon/clim/smmr.rain.1nceo1.ctl" )
MakeMenuItem(smx, mo, "SMMR Monsoon Precipitation Rate climate", Open, "open data/hydrology/precip/smmr_monsoon/clim/smmr.rain.1nxeo1.ctl" )
MakeMenuItem(sma1, mo, "SMMR Monsoon Precipitation Rate annual amplitude", Open, "open data/hydrology/precip/smmr_monsoon/harm/smmr.amp1.1nneo1.ctl" )
MakeMenuItem(sma2, mo, "SMMR Monsoon Precipitation Rate semi-annual amplitude", Open, "open data/hydrology/precip/smmr_monsoon/harm/smmr.amp2.1nneo1.ctl" )
MakeMenuItem(smp1, mo, "SMMR Monsoon Precipitation Rate annual phase", Open, "open data/hydrology/precip/smmr_monsoon/harm/smmr.phase1.1nneo1.ctl" )
MakeMenuItem(smp2, mo, "SMMR Monsoon Precipitation Rate semi-annual phase", Open, "open data/hydrology/precip/smmr_monsoon/harm/smmr.phase2.1nneo1.ctl" )
MakeMenu(st, "Temperatures")
MakeMenuItem(tf, st, "NCEP Sea Surface Temperature ", Open, "open data/surf_temp_press/ncep_sst/sst/ncep.sst.1nmego.ctl" )
MakeMenuItem(tg, st, "NCEP SST Anomalies", Open, "open data/surf_temp_press/ncep_sst/anom/ncep.anom.1nmego.ctl" )
MakeMenuItem(th, st, "NCEP SST Climate monthly", Open, "open data/surf_temp_press/ncep_sst/clim/ncep.clim.1nmego.ctl" )
MakeMenuItem(xx, st, "__________________________", NULL, NULL )
MakeMenuItem(t1, st, "East Anglia Temperature Anomalies", Open, "open data/surf_temp_press/tmp_dev/e_anglia/e_anglia.tmpdev.1nmagg.ctl" )
MakeButton(help, "Help", Browse, software/grads/help.txt)
# Once you define buttons and menus you may want to enforce their
# relative position. The very first button is always placed at the
# upper left corner.
# ----------------------------------------------------------------
# First row
SetWidgetPos(file, PLACE_UNDER, root, NO_CARE, NULL)
SetWidgetPos(options, PLACE_UNDER, root, PLACE_RIGHT, file )
SetWidgetPos(dim, PLACE_UNDER, root, PLACE_RIGHT, options )
SetWidgetPos(prompt, PLACE_UNDER, root, PLACE_RIGHT, dim )
SetWidgetPos(help, PLACE_UNDER, root, PLACE_RIGHT, prompt)
# Second row
SetWidgetPos(ac, PLACE_UNDER, file, NO_CARE, NULL)
SetWidgetPos(bi, PLACE_UNDER, file, PLACE_RIGHT, ac)
SetWidgetPos(cr, PLACE_UNDER, file, PLACE_RIGHT, bi)
# Third row
SetWidgetPos(hy, PLACE_UNDER, ac, NO_CARE, NULL)
SetWidgetPos(mo, PLACE_UNDER, ac, PLACE_RIGHT, hy)
SetWidgetPos(st, PLACE_UNDER, ac, PLACE_RIGHT, mo)
# forth row
SetWidgetPos(fresh, PLACE_UNDER, mo, NO_CARE, NULL )
SetWidgetPos(var, PLACE_UNDER, mo, PLACE_RIGHT, fresh )
SetWidgetPos(prev, PLACE_UNDER, mo, PLACE_RIGHT, var )
SetWidgetPos(displ, PLACE_UNDER, mo, PLACE_RIGHT, prev )
SetWidgetPos(next, PLACE_UNDER, mo, PLACE_RIGHT, displ )
# Fith row
SetWidgetPos(hold, PLACE_UNDER, fresh, NO_CARE, NULL )
SetWidgetPos(clear, PLACE_UNDER, fresh, PLACE_RIGHT, hold)
SetWidgetPos(rein, PLACE_UNDER, fresh, PLACE_RIGHT, clear )
SetWidgetPos(quit, PLACE_UNDER, fresh, PLACE_RIGHT, rein )
# In order to make your widgets appear on the screen you *must*
# issue this command.
# -------------------------------------------------------------
ShowDisplay()
# After your widgets appear on the screen, you can set the color
# of your widgets. The following colors are pre-defined:
# white, back, red, green, blue, yellow.
# --------------------------------------------------------------
GetNamedColor(gray,"grey")
GetNamedColor(Blue,"LightSkyBlue")
GetNamedColor(Green,"Green")
GetNamedColor(pink,"gold") # pink is actually gold, get it?
AllFgColor(black)
AllBgColor(Blue)
SetBgColor(root,white)
SetFgColor(root,red)
SetBgColor(file,green)
SetBgColor(options,green)
SetBgColor(dim,green)
SetFgColor(prompt,yellow)
SetBgColor(prompt,red)
SetFgColor(help,yellow)
SetBgColor(help,red)
SetBgColor(prev,pink)
SetBgColor(displ,pink)
SetBgColor(next,pink)
SetBgColor(play,pink)
SetBgColor(fresh,pink)
SetBgColor(var,pink)
SetBgColor(hold,gray)
SetBgColor(clear,gray)
SetBgColor(reset,gray)
SetBgColor(rein,gray)
SetBgColor(quit,gray)
# And you must call this function at the end of your first GUI script.
# This instructs the X Toolkit to enter an infinite loop, monitoring
# keyboard and mouse events. Repeating: you *must* call MainLoop().
# -------------------------------------------------------------------
MainLoop()
#........................................................................
#
# APPENDIX: Currently available callback functions
#
# Browse Opens a text file, such as a help file, on a separate
# window.
# Cmd Executes a generic GrADS command
# CmdStr Like Cmd, but the user is prompted for an additional
# string to be appended to the GrADS command.
# CmdWin Invokes a window for GrADS command line interface.
# User can click on past commands from a list.
# CmdLine Invokes the standard GrADS command line interface.
# When the command line is active the other widgets
# are not available (may be fixed in the future).
# CloseWindow Closes the current window (do not use for your primary
# window or you will get stuck).
# Display A generic callback for displaying the current variable
# (or expression) set with VarSel. The options are:
# << decrements time and executes display
# PLAY starts animation from current to last time
# DISPLAY just executes display
# >> increments time and executes display
# If the "hold" toggle state is OFF (the default),
# the screen is cleared before displaying.
# Edit Like browse, but the user can edit the file. This simple
# text editor is integrated with GrADS, providing a very
# elementary Integrated Development Enviroment (IDE) for
# GrADS scripts. In particular, the script being edited
# can be executed by clicking on a button (not
# implemented yet).
# FileSel Pops up a scrollable list and asks the user to selected
# a file among the currently opened GrADS files (including
# SDFs). The selected file becomes the default.
# Load Pops up a "file finder" widget, and after the user
# clicks on a file name it executes a GrADS command
# specified as the last argument. In case of "open" or
# "sdfopen" the files becomes the default, and the
# user is asked to select a variable from this file.
# Open Similar to Load, but the file name must be specified.
# Toggle Turn internal options ON/OFF. The only internal
# option currently supported is "hold". This callback is
# usually used with MakeToggle(), see example above.
# VarSel Pops up a scrollable list and asks the user to selected
# a variable from the default file. The user can also
# type a generic GrADS expression instead of selecting
# a single variable.
# NULL Does not do anything, used for inactive buttons.
#
#........................................................................